#ifdef __cplusplus
extern "C" {
#endif

#include "rwig.h"

int rwig_init() {
    int fail = 0;

    if(!Py_IsInitialized())
	Py_Initialize();
	
    $init_methods

finish:
    if(fail)
	rwig_finalize();

    return !fail;
}

void rwig_finalize() {
    if(PyErr_Occurred())
	PyErr_Print();

    $finalize_methods

    if(Py_IsInitialized())
	Py_Finalize();
}

#ifdef __cplusplus
} // extern "C"
#endif

/* vim: set syntax=c : */
